import {BasicColumn} from '/@/components/Table';
import {FormSchema} from '/@/components/Table';
import { rules} from '/@/utils/helper/validator';
import { render } from '/@/utils/common/renderUtils';
//列表数据
export const columns: BasicColumn[] = [

  {
    title: '序列号',
    align:"center",
    dataIndex: 'deviceSn'
  },
  {
    title: '名称',
    align:"center",
    dataIndex: 'deviceName'
  },
  {
    title: '类型',
    align:"center",
    dataIndex: 'deviceType_dictText'
  },
];
//查询数据
export const searchFormSchema: FormSchema[] = [
];
//表单数据
export const formSchema: FormSchema[] = [
  {
    label: '设备id',
    field: 'ssDeviceId',
    component: 'Input',
    dynamicRules: ({model,schema}) => {
          return [
                 { required: true, message: '请输入设备id!'},
          ];
     },
  },
  {
    label: 'box设备id',
    field: 'boxDeviceId',
    component: 'Input',
    dynamicRules: ({model,schema}) => {
          return [
                 { required: true, message: '请输入box设备id!'},
          ];
     },
  },
	// TODO 主键隐藏字段，目前写死为ID
	{
	  label: '',
	  field: 'id',
	  component: 'Input',
	  show: false
	},
];


export const formSchemaTrace: FormSchema[] = [
  {
    label: '设备编码',
    field: 'deviceCode',
    component: 'Input',
    dynamicRules: ({model,schema}) => {
      return [
        { required: true, message: '请输入设备编码!'},
      ];
    },
  },
  {
    label: '设备名称',
    field: 'deviceName',
    component: 'Input',
    dynamicRules: ({model,schema}) => {
      return [
        { required: true, message: '请输入设备名称!'},
      ];
    },
  },
  {
    label: '设备标识码',
    field: 'deviceSn',
    component: 'Input',
  },
  {
    label: '设备类型',
    field: 'deviceType',
    component: 'JDictSelectTag',
    componentProps:{
      dictCode:"deviceType",
      stringToNumber: true,
    },
    defaultValue:0,
    dynamicDisabled:true,
  },

  {
    label: '设备地址',
    field: 'deviceIp',
    component: 'Input',
  },
  // TODO 主键隐藏字段，目前写死为ID
  {
    label: '',
    field: 'id',
    component: 'Input',
    show: false
  },

];

// 高级查询数据
export const superQuerySchema = {
  ssDeviceId: {title: '设备id',order: 0,view: 'text', type: 'string',},
  boxDeviceId: {title: 'box设备id',order: 1,view: 'text', type: 'string',},
};

/**
* 流程表单调用这个方法获取formSchema
* @param param
*/
export function getBpmFormSchema(_formData): FormSchema[]{
  // 默认和原始表单保持一致 如果流程中配置了权限数据，这里需要单独处理formSchema
  return formSchema;
}
